package com.xiaoshuidi.cloud.module.rooms.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.xiaoshuidi.cloud.framework.common.pojo.CommonResult;
import com.xiaoshuidi.cloud.module.rooms.api.roomstate.dto.UpdateRoomStateReqDTO;
import com.xiaoshuidi.cloud.module.rooms.api.roomstate.vo.GetCurrentRecordRespVO;
import com.xiaoshuidi.cloud.module.rooms.api.roomstate.vo.UpdateRoomTenantReqVO;
import com.xiaoshuidi.cloud.module.rooms.pojo.RoomStateRecord;
import lombok.NonNull;

import java.util.List;

/**
 * <p>
 * 房态记录 服务类
 * </p>
 *
 * @author hans.zhang
 * @since 2023-05-15
 */
public interface RoomStateRecordService extends IService<RoomStateRecord> {

    /**
     * 保存房态
     *
     * @param roomHouseId 房源地
     * @param state       房态
     * @return 房态id
     */
    CommonResult<Long> saveRecord(Long roomHouseId, String state, String beforeState);

    /**
     * 更新房态
     * @param roomHouseId
     * @param state
     * @return
     */
    public CommonResult<Long> saveRecord(@NonNull Long roomHouseId, @NonNull String state);

    /**
     * 获取当前房态
     *
     * @param roomHouseId
     * @return
     */
    CommonResult<GetCurrentRecordRespVO> getCurrentRecord(Long roomHouseId);

    /**
     * 获取当前房态, 如果有多个房态、则进行逻辑处理
     *
     * @param roomId
     * @return
     */
    RoomStateRecord getByRoomIdAndIsCurrentState(Long roomId);

    /**
     * 根据合同状态修改房态
     *
     * @param updateRoomStateReqDTOS
     * @return
     */
    CommonResult<Boolean> updateRoomStateByContract(UpdateRoomStateReqDTO updateRoomStateReqDTOS);

    /**
     * 批量根据合同状态修改房态
     *
     * @return
     */
    CommonResult<Boolean> updateRoomStateByContract(List<UpdateRoomStateReqDTO> updateRoomStateReqDTOS);

    /**
     * 修改租住人/同住人信息
     * @param updateRoomTenantReqVO
     * @return
     */
    CommonResult<Boolean> updateRoomTenant(UpdateRoomTenantReqVO updateRoomTenantReqVO);
}
